package cn.maihe.elg.operation.repository.entity;

import cn.maihe.framework.starter.base.sql.BaseEntity;
import cn.maihe.framework.starter.base.sql.MapperInterface;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@TableName("t_guarantee_template")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@MapperInterface("cn.maihe.elg.operation.repository.mapper.GuaranteeTemplateMapper")
public class GuaranteeTemplateDO extends BaseEntity {
    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 机构id
     */
    @TableField(value = "org_id")
    private Long orgId;

    /**
     * 模板类型(保函类型)数据字典
     */
    @TableField(value = "guarantee_type")
    private String guaranteeType;

    /**
     * 保函品种数据字典
     */
    @TableField(value = "guarantee_category")
    private String guaranteeCategory;

    /**
     * 模板名称
     */
    @TableField(value = "template_name")
    private String templateName;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;

    /**
     * 更新时间
     */
    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    /**
     * 创建用户
     */
    @TableField(value = "user_create", fill = FieldFill.INSERT)
    private String userCreate;

    /**
     * 更新用户
     */
    @TableField(value = "user_modified", fill = FieldFill.INSERT_UPDATE)
    private String userModified;

    /**
     * 启用状态 0否 1是
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 签章页码
     */
    @TableField(value = "sign_page_no")
    private Integer signPageNo;

    /**
     * 签章水平位置
     */
    @TableField(value = "sign_horizontal")
    private Integer signHorizontal;

    /**
     * 签章垂直位置
     */
    @TableField(value = "sign_vertical")
    private Integer signVertical;

    /**
     * 模板内容
     */
    @TableField(value = "content")
    private String content;

    public GuaranteeTemplateVo buildVo() {
        return new GuaranteeTemplateVo(id, orgId, guaranteeType, guaranteeCategory, templateName, gmtCreate, gmtModified, userCreate, userModified, status, signPageNo, signHorizontal, signVertical, content);
    }

    public static GuaranteeTemplateDO of(GuaranteeTemplateVo vo) {
        return new GuaranteeTemplateDO(vo.getId(), vo.getOrgId(), vo.getGuaranteeType(), vo.getGuaranteeCategory(), vo.getTemplateName(), vo.getGmtCreate(), vo.getGmtModified(), vo.getUserCreate(), vo.getUserModified(), vo.getStatus(), vo.getSignPageNo(), vo.getSignHorizontal(), vo.getSignVertical(), vo.getContent());
    }
}
